package com.abuaziz.librarys

import android.os.Bundle
import com.chad.library.adapter.base.entity.MultiItemEntity

class MainActivity : BaseActivity() {

    val LEVEL_COMPANY = 0
    val LEVEL_DEPARTMENT = 1
    val LEVEL_EMPLOYE = 2

//    inner class Employee(var name: String) : MultiItemEntity {
//        override fun getItemType(): Int = LEVEL_EMPLOYE
//    }
//
//    inner class Department(var name: String) : AbstractExpandableItem<Employee>(), MultiItemEntity {
//        override fun getLevel(): Int = LEVEL_DEPARTMENT
//        override fun getItemType(): Int = LEVEL_DEPARTMENT
//    }
//
//    inner class Company(var name: String) : AbstractExpandableItem<Department>(), MultiItemEntity {
//        override fun getLevel(): Int = LEVEL_COMPANY
//        override fun getItemType(): Int = LEVEL_COMPANY
//    }

    override fun onCreate(savedInstanceState: Bundle?) {
//        initLanguage()
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_expandable_recycler)

//        var adapter = createRecyclerExpandableAdapter(datas()) {
//            addLevel(LEVEL_COMPANY, R.layout.item_expandable)
//            addLevel(LEVEL_DEPARTMENT, R.layout.item_expandable)
//            addLevel(LEVEL_EMPLOYE, R.layout.item_expandable)
//            onBindData { level, view, data, position ->
//                val itemView = view.findTextView(R.id.item)
//                when (data) {
//                    is Company -> {
//                        itemView.setBackgroundColor(Color.WHITE)
//                        itemView.content = "$position - ${data.name}"
//                    }
//                    is Department -> {
//                        itemView.setBackgroundColor(Color.RED)
//                        itemView.content = "$position - ${(data as Department).name}"
//                    }
//                    is Employee -> {
//                        itemView.setBackgroundColor(Color.BLUE)
//                        itemView.content = "$position - ${(data as Employee).name}"
//                    }
//                }
//            }
//        }

//        recyclerView.adapter = adapter
//        recyclerView.layoutManager = GridLayoutManager(this, 1)


    }

//    fun datas(): List<MultiItemEntity> {
//        var res = ArrayList<MultiItemEntity>()
//        for (c in 0..4) {//Company
//            var company = Company("这是公司")
//            for (d in 0..8) {//Departmennt
//                var department = Department("这是部门")
//                company.addSubItem(department)
//                for (e in 0..15) {//Employee
//                    var employee = Employee("这是员工")
//                    department.addSubItem(employee)
//                }
//
//            }
//            res.add(company)
//        }
//        return res
//    }
}
